<%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2021/6/22
  Time: 16:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="js/jquery-2.1.0.js"></script>
    <script type="text/javascript">
        // $(function (){
        //     $("#btn").click(function (){
        //         let inputValue=$("#input").val();
        //         $.ajax({
        //             url:"huixian_text",
        //             type:"get",
        //             data:{"inputValue":inputValue},
        //             dataType:"json",
        //             success:function (data){
        //                 $("#app").append("<ul>")
        //                     .append("<li>"+data.firstName+"</li>")
        //                     .append("<li>"+data.lastName+"</li>")
        //                     .append("</ul>")
        //             }
        //         })
        //     })
        // })

        function methods(value){
            $(function (){
                $.ajax({
                    url:"huixian_text",
                    type:"get",
                    data:{"inputValue":value},
                    dataType:"json",
                    success:function (data){
                        $("#app").append("<ul>")
                            .append("<li>"+data.firstName+"</li>")
                            .append("<li>"+data.lastName+"</li>")
                            .append("</ul>")
                    }
                })
            })
        }
    </script>
</head>
<body>
<div id="app">
    <input type="text" id="input" />
    <button id="btn" onclick="methods('ai')">按钮</button>
    <button id="btn2" onclick="methods('ni')">按钮</button>
</div>
</body>
</html>
